*Does School Debating Reduce Vulnerability to Misinformation? A Field Experiment in Poland
*Authors: Krzysztof Krakowski, Bernhard Clemm von Hohenberg, Davide Morisi
*Journal: The Journal of Politics

*This file replicates the following:
*Recoding of the dataset

*31 January 2025

*ssc install fre
*ssc instal distinct

*working directory
cd "[insert your directory]"

*open data
use "data/misinformation_data.dta", clear


****
*socio-demographics

*gender
recode gender (1=1 "female") (nonmissing=0 "other"), gen(female)
label variable female "Female"
fre female

*age
recode age (13/14=1 "13-14") (15=2 "15") (16=3 "16") (17/22=4 "17+"), gen(age_cat)
label var age_cat "Age categories"
fre age_cat

*edu level of mother
recode mother_edu_level (4=1 "university level") (nonmissing=0 "other"), gen(mother_edu)
label variable mother_edu "Mother's level of education"
fre mother_edu

*household size
recode hh_size 5/20=5, gen(hh_size_rec)
label de hh_size_rec 5 "5+"
label val hh_size_rec hh_size_rec
fre hh_size_rec

*religiosity
recode religiosity (1/2=1 "important") (3/4=0 "not important") (99=99 "prefer not to reply"), gen(religiosity3)
label var religiosity3 "How important is religion in your life?"
fre religiosity3

*financial situation
recode financial 4/5=3 99=99, gen(financial4)
label de financial4 1"Good" 3"Not good" 99"dk/no reply"
label val financial4 financial4
fre financial4

*support for right-wing party
fre preferred_party
recode preferred_party (1=1 "Right-wing party") (nonmissing=0 "Other party/No reply"), gen(right_wing)
label var right_wing "Favorite party"
fre right_wing

***
*DVs

*Conspiracy thinking
label de agree_reverse 5"strongly agree" 1"strongly disagree"
forvalues i =1/5 {
	recode conspiracy_item`i' (1 = 5) (2 = 4) (4 = 2) (5 = 1) (99=.), gen(conspiracy_item`i'r)
	recode pre_conspiracy_item`i' (1 = 5) (2 = 4) (4 = 2) (5 = 1) (99=.), gen(pre_conspiracy_item`i'r)
	label val conspiracy_item`i'r agree_reverse
	label val pre_conspiracy_item`i'r agree_reverse
}
egen conspiracy = rowmean(conspiracy_item*r)
egen conspiracy_pre = rowmean(pre_conspiracy_item*r)
*rescaled from 0 to 1
gen conspiracy01 = (conspiracy-1)/4
gen conspiracy_pre01 = (conspiracy_pre-1)/4


*credibility of true statement 
egen true_trust = rowmean(Q76_13 Q76_14 Q76_17 Q76_19 Q76_20 Q76_21 Q76_22 Q76_24)
egen true_trust_all = rowmean(Q76_13 Q76_14 Q76_15 Q76_16 Q76_17 Q76_18 Q76_19 Q76_20 Q76_21 Q76_22 Q76_23 Q76_24)
egen true_trust_pre = rowmean(pre_Q76_13 pre_Q76_14 pre_Q76_17 pre_Q76_19 pre_Q76_20 pre_Q76_21 pre_Q76_22 pre_Q76_24)
egen true_trust_pre_all = rowmean(pre_Q76_13 pre_Q76_14 pre_Q76_15 pre_Q76_16 pre_Q76_17 pre_Q76_18 pre_Q76_19 pre_Q76_20 pre_Q76_21 pre_Q76_22 pre_Q76_23 pre_Q76_24)
label var true_trust "Average credibility SELECTED true statements"
label var true_trust_pre "Average credibility SELECTED true statements PRE"
label var true_trust_all "Average credibility ALL true statements"
label var true_trust_pre_all "Average credibility ALL true statements PRE"
label val true_trust credible
label val true_trust_all credible
label val true_trust_pre credible
label val true_trust_pre_all credible
fre true_trust*
*rescaled from 0 to 1
gen true_trust01 = (true_trust-1)/6
gen true_trust_all01 = (true_trust_all-1)/6
gen true_trust_pre01 = (true_trust_pre-1)/6
gen true_trust_pre_all01 = (true_trust_pre_all-1)/6
label var true_trust01 "Average credibility SELECTED true statements"
label var true_trust_pre01 "Average credibility SELECTED true statements PRE"
label var true_trust_all01 "Average credibility ALL true statements"
label var true_trust_pre_all01 "Average credibility ALL true statements PRE"
label val true_trust01 credible01
label val true_trust_all01 credible01
label val true_trust_pre01 credible01
label val true_trust_pre_all01 credible01
fre true_trust true_trust01 true_trust_all01
*standardized
egen st_true_trust = std(true_trust)
egen st_true_trust_all = std(true_trust_all)
egen st_true_trust_pre = std(true_trust_pre)
egen st_true_trust_pre_all = std(true_trust_pre_all)

*credibility of false statements
sum Q76_1 Q76_2 Q76_3 Q76_4 Q76_5 Q76_6 Q76_7 Q76_8 Q76_9 Q76_10 Q76_11 Q76_12
sum pre_Q76_1 pre_Q76_2 pre_Q76_3 pre_Q76_4 pre_Q76_5 pre_Q76_6 pre_Q76_7 pre_Q76_8 pre_Q76_9 pre_Q76_10 pre_Q76_11 pre_Q76_12
egen false_trust = rowmean(Q76_2 Q76_3 Q76_4 Q76_5 Q76_7 Q76_9 Q76_10 Q76_12)
egen false_trust_all = rowmean(Q76_1 Q76_2 Q76_3 Q76_4 Q76_5 Q76_6 Q76_7 Q76_8 Q76_9 Q76_10 Q76_11 Q76_12)
egen false_trust_pre = rowmean(pre_Q76_2 pre_Q76_3 pre_Q76_4 pre_Q76_5 pre_Q76_7 pre_Q76_9 pre_Q76_10 pre_Q76_12)
egen false_trust_pre_all = rowmean(pre_Q76_1 pre_Q76_2 pre_Q76_3 pre_Q76_4 pre_Q76_5 pre_Q76_6 pre_Q76_7 pre_Q76_8 pre_Q76_9 pre_Q76_10 pre_Q76_11 pre_Q76_12)
label var false_trust "Average credibility SELECTED false statements"
label var false_trust_pre "Average credibility SELECTED false statements PRE"
label var false_trust_all "Average credibility ALL false statements"
label var false_trust_pre_all "Average credibility ALL false statements PRE"
label val false_trust credible
label val false_trust_all credible
label val false_trust_pre credible
label val false_trust_pre_all credible
sum false_trust*
*rescaled from 0 to 1
gen false_trust01 = (false_trust-1)/6
gen false_trust_all01 = (false_trust_all-1)/6
gen false_trust_pre01 = (false_trust_pre-1)/6
gen false_trust_pre_all01 = (false_trust_pre_all-1)/6
label de credible01 0 "totally not credible" 1 "entirely credible"
label var false_trust01 "Average credibility SELECTED false statements"
label var false_trust_pre01 "Average credibility SELECTED false statements PRE"
label var false_trust_all01 "Average credibility ALL false statements"
label var false_trust_pre_all01 "Average credibility ALL false statements PRE"
label val false_trust01 credible01
label val false_trust_all01 credible01
label val false_trust_pre01 credible01
label val false_trust_pre_all01 credible01
*standardized
egen st_false_trust = std(false_trust)
egen st_false_trust_all = std(false_trust_all)
egen st_false_trust_pre = std(false_trust_pre)
egen st_false_trust_pre_all = std(false_trust_pre_all)

*gap between true and false statements
gen false_true_gap = true_trust - false_trust
gen false_true_all = true_trust_all - false_trust_all
gen false_true_pre_gap = true_trust_pre - false_trust_pre
gen false_true_pre_all = true_trust_pre_all - false_trust_pre_all
label var false_true_gap "positive=true statements more credible than false"
label var false_true_all "positive=true statements more credible than false ALL STATEMENTS"
label var false_true_pre_gap "positive=true statements more credible than false PRE"
label var false_true_pre_all "positive=true statements more credible than false ALL STATEMENTS PRE"
fre false_true_gap false_true_all // the more positive, the more credible true statements vs false statements
list false_trust_pre true_trust_pre false_true_pre_gap in 50/60
*rescaled from -1 to 1
gen false_true_gap01 = true_trust01 - false_trust01
gen false_true_all01 = true_trust_all01 - false_trust_all01
gen false_true_pre_gap01 = true_trust_pre01 - false_trust_pre01
gen false_true_pre_all01 = true_trust_pre_all01 - false_trust_pre_all01
label var false_true_gap01 "positive=true statements more credible than false"
label var false_true_all01 "positive=true statements more credible than false ALL STATEMENTS"
label var false_true_pre_gap01 "positive=true statements more credible than false PRE"
label var false_true_pre_all01 "positive=true statements more credible than false ALL STATEMENTS PRE"
fre false_true_gap01
*standardized
egen st_false_true_gap = std(false_true_gap)
egen st_false_true_all = std(false_true_all)
egen st_false_true_pre_gap = std(false_true_pre_gap)
egen st_false_true_pre_all = std(false_true_pre_all)


***
*mediators / moderators

*need for closure
*PRE survey
*aggregate with pca
pca pre_need*, mineigen(1)
rotate, varimax
predict pre_need_pca, score
pwcorr pre_need* // the higher the values, the lower close-mindedness
*rescale from 0 to 1
egen min_pca  =  min(pre_need_pca)  
egen max_pca  =  max(pre_need_pca)  
gen pre_need_pca01  =  (pre_need_pca  -  min_pca)/(max_pca  -  min_pca)
drop min_pca max_pca
sum pre_need_pca*
*POST survey
*aggregate with pca
pca need*, mineigen(1)
rotate, varimax
predict need_pca, score
pwcorr need* // the higher the values, the lower close-mindedness
*rescale from 0 to 1
egen min_pca  =  min(need_pca)  
egen max_pca  =  max(need_pca)  
gen need_pca01  =  (need_pca  -  min_pca)/(max_pca  -  min_pca)
drop min_pca max_pca

*trust in the media
*pre
egen pre_trust_media = rowmean(pre_trust_tv pre_trust_paper pre_trust_social)
gen pre_trust_media01 = (pre_trust_media-1)/6
label de trust01 0"no trust" 1"complete trust"
label val pre_trust_media01 trust01
fre pre_trust_media01
*post
egen trust_media = rowmean(trust_tv trust_paper trust_social)
gen trust_media01 = (trust_media-1)/6
label val trust_media01 trust01
fre trust_media01

*discussing politics with parents/friends
*combined index
egen pre_discussion = rowmean(pre_discuss_parent pre_discuss_friend) // the higher the value, the less discussion
egen discussion = rowmean(discuss_parent discuss_friend) // the higher the value, the less discussion
gen pre_discussion_rev = ((-pre_discussion)+5)/4
gen discussion_rev = ((-discussion)+5)/4
label var discussion_rev "How often talk to parents/friends about political/social issues POST"
label var pre_discussion_rev "How often talk to parents/friends about political/social issues PRE"
label de disc_rev 0"Never" 1"Everyday"
label val discussion_rev disc_rev
label val pre_discussion_rev disc_rev
fre *discussion_rev

*political interest
gen pol_int = ((-Q78)+4)/3
gen pre_pol_int = ((-pre_Q78)+4)/3
label de pol_int 0"not interested" 1"very interested"
label val pol_int pol_int
label val pre_pol_int pol_int
label var pol_int "To what extent are you interested in politics? POST"
label var pre_pol_int "To what extent are you interested in politics? PRE"

***
*workshop
egen workshop1 = concat(schoolen treat_all) if treat_all!=.
encode workshop1, gen(workshop)
replace workshop = 999 if treat_all==0 // recoding all no activities as one cluster
replace workshop = 1000 if schoolen==10 & treat_bin==0 // recoding missing detailed level as one cluster
replace workshop = 1010 if schoolen==10 & treat_bin==1 // recoding missing detailed level as one cluster
distinct workshop
drop workshop1

save "data/misinformation_recode.dta", replace


***
*Keep only people who completed the panel and were assigned to a condition

use "data/misinformation_recode.dta", clear

*drop if not assigned to any conditions
drop if treat_bin==. 

*keep only people who took both W1 and W3
drop if panel_W1W3!=3 

*impute missing value for age
fre age_cat
sum age, d
replace age_cat=2 if age_cat==. // impute median value for missing value

***
*imputating missing values for pre-treatment outcomes
quietly summarize true_trust_pre01
local mean_true_trust_pre01 = r(mean)
recode true_trust_pre01 (.=`mean_true_trust_pre01'), gen(true_trust_pre01_imp)
gen true_trust_pre01_miss = 0
replace true_trust_pre01_miss = 1 if true_trust_pre01==.

quietly summarize true_trust_pre_all01
local mean_true_trust_pre_all01 = r(mean)
recode true_trust_pre_all01 (.=`mean_true_trust_pre_all01'), gen(true_trust_pre_all01_imp)
gen true_trust_pre_all01_miss = 0
replace true_trust_pre_all01_miss = 1 if true_trust_pre_all01==.

quietly summarize false_trust_pre01
local mean_false_trust_pre01 = r(mean)
recode false_trust_pre01 (.=`mean_false_trust_pre01'), gen(false_trust_pre01_imp)
gen false_trust_pre01_miss = 0
replace false_trust_pre01_miss = 1 if false_trust_pre01==.

quietly summarize false_trust_pre_all01
local mean_false_trust_pre_all01 = r(mean)
recode false_trust_pre_all01 (.=`mean_false_trust_pre_all01'), gen(false_trust_pre_all01_imp)
gen false_trust_pre_all01_miss = 0
replace false_trust_pre_all01_miss = 1 if false_trust_pre_all01==.

quietly summarize false_true_pre_gap01
local mean_false_true_pre_gap01 = r(mean)
recode false_true_pre_gap01 (.=`mean_false_true_pre_gap01'), gen(false_true_pre_gap01_imp)
gen false_true_pre_gap01_miss = 0
replace false_true_pre_gap01_miss = 1 if false_true_pre_gap01==.

quietly summarize false_true_pre_all01
local mean_false_true_pre_all01 = r(mean)
recode false_true_pre_all01 (.=`mean_false_true_pre_all01'), gen(false_true_pre_all01_imp)
gen false_true_pre_all01_miss = 0
replace false_true_pre_all01_miss = 1 if false_true_pre_all01==.

*conspiracy
quietly summarize conspiracy_pre01
local mean_conspiracy_pre01 = r(mean)
recode conspiracy_pre01 (.=`mean_conspiracy_pre01'), gen(conspiracy_pre01_imp)
gen conspiracy_pre01_miss = 0
replace conspiracy_pre01_miss = 1 if conspiracy_pre01==.


***
*create categories of demographics for interacted models
tab age_cat, gen(age_cat_cat)
tab financial4, gen(financial4_cat)
tab religiosity3, gen(religiosity3_cat)

*Create mean-centered variables for fully interacted models
foreach var of varlist female mother_edu ///
age_cat_cat2 age_cat_cat3 age_cat_cat4 financial4_cat2 financial4_cat3 financial4_cat4 religiosity3_cat2 religiosity3_cat3 ///
hh_size_rec right_wing ///
true_trust_pre_all01_imp false_trust_pre_all01_imp false_true_pre_all01_imp conspiracy_pre01_imp ///
true_trust_pre_all01_mis false_trust_pre_all01_mis false_true_pre_all01_mis conspiracy_pre01_mis ///
true_trust_pre01 false_trust_pre01 false_true_pre_gap01{
	sum `var', meanonly
	gen c`var' = `var' - r(mean)
	gen int`var' = treat_bin * c`var'
}
drop age_cat_cat1 age_cat_cat2 age_cat_cat3 age_cat_cat4 financial4_cat1 financial4_cat2 financial4_cat3 financial4_cat4 religiosity3_cat1 religiosity3_cat2 religiosity3_cat3


***
*Mediating variables (differences between pre and post measures)
gen d_need_pca01 = need_pca01-pre_need_pca01
gen d_trust_media01 = trust_media01-pre_trust_media01
gen d_pol_int = pol_int-pre_pol_int
gen d_discussion = discussion_rev-pre_discussion_rev


***
save "data/misinformation_recode_panel.dta", replace

